//package com.handsome.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
//import org.springframework.data.redis.serializer.StringRedisSerializer;
//
///**
// * @Author Handsome
// * @Date 2022/3/5 20:03
// * @Version 1.0
// */
//@SuppressWarnings({"all"})
//@Configuration
//public class RedisConfiguration {
//    @Bean
//    public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) {
//        // 1.创建 redisTemplate 模版
//        RedisTemplate redisTemplate = new RedisTemplate<>();
//        // 2.关联 redisConnectionFactory
//        redisTemplate.setConnectionFactory(redisConnectionFactory);
//        // 3.设置 value 的转化格式
//        redisTemplate.setKeySerializer(new StringRedisSerializer());
//        // 4.设置 key 的转化格式
//        // redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializer(Object.class));
//        redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
//        // 5.允许Redis开启事务
//        // redisTemplate.setEnableTransactionSupport(true);
//        // 6.返回redisTemplate对象
//        return redisTemplate;
//    }
//}
